package com.example.springdemo.controller;

import com.example.springdemo.event.UserEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController()
public class UserController {
    @Autowired
    ApplicationContext applicationContext;
    @RequestMapping("register")
    public Object register(){
        applicationContext.publishEvent(new UserEvent("张三",12));
        return "注册成功";
    }
}
